﻿<?php
if (!defined('INDEX')) {
	exit ('Access Denied');
}
$parameter=act_wap_goods();
extract($parameter);
if ($_GET['code'] === 'youhaoquan' || $_GET['code'] === 'chongzhi' || $_GET['code'] === 'qqyouhui' || $_GET['code'] === 'jiu' || $_GET['code'] === 'shijiu' || $_GET['code'] === 'chaofan') {
	exit;
} else {
	include(TPLPATH.'/admin_set/quan.php');
	$cid=(int)$_GET['cid'];
	$goods_type=$duoduo->select_all("type","id,title","tag='goods'".$where_type." order by sort=0 asc,sort asc,id desc");
		foreach($goods_type as $k=>$vo){
			$canshu=array();
			if($bankuai_code){
				$canshu['code']=$bankuai_code;
			}
			$canshu['cid']=$vo['id'];
			if($_GET['do']){
				$canshu['do']=$_GET['do'];
			}
			$goods_type[$k]['url']=u('goods','index',$canshu);
		}
	
	include(TPLPATH.'/inc/header_1.tpl.php');
}
?>
<style type="text/css">
.lanmutop{ width:100%; position:fixed;top:44px;z-index:999;}
.lanmu2{ width:100%;font-size:14px;background:#fff;z-index:90;}
.lanmu2 li{ float:left;width:25%;text-align:center;height:40px; line-height:40px;background:#FFFFFF;border-bottom:1px #eee solid;}
.lanmu2 li a{color:#555;}
.lanmu2 li .jx{color:#ff3366;height:39px; border-bottom:2px #ff3366 solid; display:block}
.jy_w_buy
{
    float:right; overflow:hidden; text-align:right
}
.jy_w_buy .tb
{
    width:20px; margin-left:15px;
    height:20px;
    float:right;
    color:#CE0000;
    font-size:14px;
    line-height:20px;
    margin-top:5px;
    *margin-top:2px;
}
.jy_w_buy .tmall
{
    width:20px;margin-left:15px;
    height:20px;
    float:right;
    color:#CE0000;
    font-size:15px;
    line-height:20px;
    margin-top:5px;
    *margin-top:2px;
}
.jy_w_buy .jd
{
    min-width:20px;
    height:20px;
    float:right;
    color:#CE0000;
    font-size:15px;
    line-height:20px;
    margin-top:5px;
    *margin-top:2px;
}
.jy_w_buy .paipai
{
    min-width:50px;
    height:20px;
    float:right;
    color:#CE0000;
    font-size:15px;
    line-height:20px;
    margin-top:5px;
    *margin-top:2px;
}
.jy_w_buy .tb i
{
    width:20px;
    height:20px; vertical-align:bottom; margin-bottom:3px;
    display:inline-block;
    background:url(m/template/miaozhewap/inc/images/tb.png) no-repeat;
    margin-right:5px;
}
.jy_w_buy .tmall i
{
    width:20px;
    height:20px;vertical-align:bottom; margin-bottom:3px;
    display:inline-block;
    background:url(m/template/miaozhewap/inc/images/tmall_ico.png) no-repeat;
    margin-right:5px;
}
.jy_w_buy .jd i
{
    width:20px;
    height:20px;vertical-align:bottom; margin-bottom:3px;
    display:inline-block;
    background:url(m/template/miaozhewap/inc/images/jd_ico.png) no-repeat;
    margin-right:5px;
}

.jy_w_buy .paipai i
{
    width:15px;
    height:15px;vertical-align:bottom; margin-bottom:3px;
    display:inline-block;
    background:url(m/template/miaozhewap/inc/images/pai_ico.png) no-repeat;
    margin-right:5px;
}
</style>
<?php
if (! isset($_GET['cid'])) {
?>
<script>
var floorStep=2;
var ajaxTag=0;
$(function(){
	$(window).bind('scroll',function(){
		if($(window).scrollTop()+$(window).height()>=$(document).height()-400){
			if(ajaxTag==0){
				ajaxTag=1;
				jiazai(floorStep);
				floorStep++;
			}
		}
	});
	$('.shuju_load img.lazy').lazyload({
		threshold:20,
		failure_limit:50
	});
});
//这里的格式不能动！
function index_tpl(){/*<li class="claer">   <a href="{$url}">
		            <span class="tupian"> <img data-original="{$img}" title="{$title}" class="lazy" src="<?=$dd_tpl_data['loading_img']?>" alt="{$title}" border="0"/> </span>   {$xin}</a>
					{$youhuiquan}
              <a href="{$url}"><span class="biaoti">{$title}</span></a>
                         <span class="jiage">
		                 {$quan_hou}  <span>￥</span>{$quanhoujia}
		                  <del>{$price}</del>
		                <span class="baoyou">{$laiyuan}</span> </span>
					 <span class="fan">
		               <span>券后返利：</span>{$quanhoufan}</span>
                    </li>*/}

function jiazai(floorStep){	
	$('.chakan_more').text('数据获取中……');
	var url='<?=wap_l(MOD,ACT)?>&code='+'<?=$code?>'+'&q='+'<?=$_GET['q']?>'+'&cid='+'<?=$_GET['cid']?>'+'&page='+floorStep;
	$.getJSON(url,function(data){
		ajaxTag=0;
		if(data.s=='1'){
			if(data.r=='' || data.r=='null' || data.r==null){
				alert('没有了');
				ajaxTag=1;
				$('.chakan_more').hidden();
			}
			else{
				for(i in data.r){
					row=data.r[i];
					var html=getTplObj(index_tpl,row);
					$('.shuju_load').append(html);
				}
				$('.chakan_more').text('点击更多');
				$('.shuju_load img.lazy').lazyload({
					threshold:20,
					failure_limit:50
				});
			}
		}
	});
}
</script>
<?php } ?>
<div class="lanmutop"> 
  <div class="lanmu2">
<li><a href="<?=wap_l('tao','index')?>" class="jx">商品分类</a></li>
<li><a href="<?=wap_l('goods','index',array('cid'=>$cid)) . '&is_new=1'?>" class="jx">最新上架</a></li>
<li><a href="<?=wap_l('goods','index',array('cid'=>$cid)) . '&is_hot=1'?>" class="jx">最高人气</a></li>
<li><a href="<?=wap_l('goods','index',array('cid'=>$cid)) . '&is_low=1'?>" class="jx">最低价</a></li>
</div> 
<div class="clear"></div>
  <div style="background:#FFFFFF; height:40px; border-bottom:#eee 1px solid;">
  <div id="search-box">
            <form id="search-form" action="<?=wap_l(MOD,ACT)?>" method="get">
                <div class="box-search">
			 <input type="hidden" name="mod" value="goods" />
			 <input type="hidden" name="act" value="index" />
			 <input type="hidden" name="code" value="<?=$code?>" />
                    <select name="search_method" id="search-method">
                        <option value="0">淘宝</option>
                        <option value="1">京东</option>
                    </select>
	<input type="text" id="keywords2" name="q" class="keyW text" value="" placeholder="懒得找了，搜索关键词" style="color:#999;" />
                    <a href="javascript:;" class="del"><img src="<?=TPLURL?>/inc/images/del.png"></a>
                <button id="search-submit" type="submit" onClick="document.getElementById('keyword').value=encodeURI(document.getElementById('keyword').value);getId('search-form').submit()">
                    <img src="<?=TPLURL?>/inc/images/search.png" style="vertical-align:top; margin-top:-35px">
                </button>
             </div> 
            </form>
      </div>
	     </div>
</div>

    <div class="p5" style="margin-top:123px">
   <ul class="remai2 shuju_load">
        <?php foreach ($shuju_data as $k => $row) { ?>
            <li class="claer"><a href="<?= $row['url'] ?>">
                    <span class="tupian"> <img data-original="<?= tb_img($row['img'], 800) ?>"
                                               title="<?= $row['title'] ?>" class="lazy"
                                               src="<?= $row['img'] ?>" alt="<?= $row['title'] ?>"
                                               border="0"/> </span> <?php if ($row['is_new']) { ?><span
                            class="xinpin"></span>  <?php } ?>  </a>
				<span class="jiage">
                    <span>￥</span><?= $row['quanhoujia'] ?>
					<span><?= $row['discount_price'] ?></span>
                    <?php if ($code == 'zhidemai') { ?><?php } else { ?>
                        <del><?= $row['price'] ?></del> <?php } ?>
                    <span class="baoyou"><?= $row['laiyuan'] ?></span> </span>
                <div class="inblock guan" style="position:absolute;top:0;left:0;">
                    <div class="jy_w_buy">
                        <?php if ($row['laiyuan_type'] == 1) { ?>
                            <div title="淘宝" class="tb"><i></i></div><?php } ?>

                        <?php if ($row['laiyuan_type'] == 2) { ?>
                            <div title="天猫" class="tmall"><i></i></div><?php } ?>
                        <?php if ($row['laiyuan_type'] == 3) { ?>
                            <div title="京东商城" class="jd"><i></i></div><?php } ?>
                        <?php if ($row['laiyuan_type'] == 4) { ?>
                            <div title="拍拍" class="paipai"><i></i></div><?php } ?>
                    </div>
                </div>			
				<span class="xiaoliang" style="float:left;color:#808080;display:block;margin-left:5px;margin-top:5px;">月销&nbsp;<?= $row['xiaoliang'] ?></span>
				<span class="pingfen" style="float:right;color:#808080;display:block;margin-right:5px;margin-top:5px;">评分&nbsp;<?= $row['pingfen'] ?></span>
				<div style="clear:both;"></div>
                <?php if ($row['price_man'] > 0) { ?>
                    <a href="<?= $row['lq_url'] ? $row['lq_url'] : 'javascript:void(0)' ?>">
                        <div class="quan_img"><span class="num_money left"><?= $row['price_jian'] ?></span></div>
                    </a>  <?php } ?>
                <a href="<?= $row['url'] ?>"><span class="biaoti"><?= $row['title'] ?></span></a>
                
            </li>
        <?php } ?>
    </ul>
			 
</div>
<!--<a class="chakan_more">下拉加载更多</a>-->
<div class="megas513" style="padding:10px; ">
  <?=pageft($total,$pagesize,wap_l(MOD,ACT,array('code'=>$code)),WJT)?>
</div>
  <a href="javascript:scroll(0,0)" hidefocus="true" title="回到顶部" id="scrollTop"></a>
<?php include(TPLPATH.'/inc/tdj.tpl.php');?>
<?php include(TPLPATH.'/inc/footer.tpl.php');?>